Top 10k strings from Turbo Compiler v1.0 - Tutorial (1991)(Jonathan Cauldwell).tzx
in <root> / bin / z80 / software / Sinclair Spectrum Collection TOSEC.exe / Sinclair ZX Spectrum - Utilities & Educational / Sinclair ZX Spectrum - Utilities & Educational - [TZX] (TOSEC-v2007-01-01) /
Back to the directory listing
2 ;"Tutorial v1.0"; 2 ;"Turbo BASIC:"' 2 "Sinclair BASIC:"' 1 will produce a short 'crash'..." 1 trapping routines, and will 1 these operators priority over 1 there are exceptions When using any of the mathematics operators'* / ^'. Turbo does NOT give 1 the last command on any line." 1 than the screen. IE these are 1 supported in version 1.0, it is easy enough to check for key 1 statements. The following 1 statements on a line after a 1 some circumstances but not in 1 simulated by THEN IF. EG:" 1 simple compiler. Many existing 1 saying:"'' 1 same in both programs although 1 routine demonstrates this and 1 programmer. The main ones are 1 program. (It's very trusting!) There is no syntax checking as 1 presses. PEEK 23556 will returnthe upper case ASCII code of anykey pressed, or 255 if no keys 1 possible to do this. Instead, 1 pitch and must be positive." 1 particular circumstances it is 1 others. Again, see option 4." 1 other operations the way that 1 of accuracy when performing somecalculations." 1 of a circle with radius 78cm. 1 numbers are stored as positive 1 not a string." 1 normally would, but don't use 1 manual to find which values to 1 literal, rather than a computed line number. If line does not 1 listed here." 1 judiciously to specify the orderof evaluation. EG:" 1 integers." 1 integers instead of real numbersthere will sometimes be a lack 1 held in memory at location 40000terminating with code 255. Usingthis concept it is not difficultto write INPUT routines, string splicing, concatenation etc." 1 have to use 'SAVE!' and 'LOAD!',whereas +2A and +3 owners use 1 graphic 'A'. For every UDG 1 giving it a reasonably correct 1 generally rely on the user 1 for numbers, negatives work in 1 following enhancements:" 1 first must be a numeric literal from 0-10, and may be fractionalThis is the only situation whereTurbo can handle non-integers. 1 facilities available to the 1 exist an error results." 1 example demonstrates this, alongwith an INKEY$ conversion." 1 directly. 128K and +2 users 1 differences in commands between Sinclair BASIC and Turbo BASIC. IE, where a command is slightly different or won't work in 1 described as follows..." 1 demonstration BASIC game to 1 copy the compiler itself!" 1 convert to Sinclair BASIC formatdivide result by 100. Example.." 1 concept will not..." 1 compiled program, since all 1 common rounding technique can beapplied. Multiply PI by 100 to give two more significant digitsthen multiply that by 78. 1 colour controls such as PAPER, 1 clever programming techniques, 1 cannot have a string as an 1 cannot be less than 24320." 1 calculations can lead to bigger errors.": 1 by a numeric literal. Literal 1 being pressed at once. In thesecases use the IN function as youwould normally. (Check the 1 be a literal, and not a computedline number. Error if line doesnot exist." 1 as can arrays. (See option 4 onthe main menu for details.) As 1 argument, making it difficult tofind the address of the first 1 are being pressed. Alternativelyuse PEEK 23560 for both upper 1 approximation. Thus:" 1 and lower case." 1 after 'A', add 8 to the address." 1 address 32765."' 1 You'll have to write out two 1 UDG. This can be acheived in a different way..." 1 Turbo, most (if not all) of themcan be simulated in one way or 1 This is the instruction program for Turbo Compiler v1.0. It can either be run from Sinclair 1 The second argument specifies 1 TUTOR 1 Sinclair BASIC would normally beexpected to handle that side of things." 1 Sinclair BASIC into ready-to-runZ80 code. All compiled programsrun independently of the utilityso you can copy or sell them if you wish, providing you don't 1 Sinclair BASIC does. Therefore,brackets should be used 1 Sinclair BASIC are missing in 1 In sinclair BASIC we get:"' 1 Finally, divide the result by 1 Drive, Eastwood, Notts NG16 3RS." 1 DATA statement - so make DATA 1 D5 48K lock" 1 D4 ROM 1 D3 screen 1 Created with Ramsoft MakeTZX 1 Bit Field: 1 BASIC, or compiled and then run. 1 BASIC programs will need severalchanges made to them before theywill run properly with Turbo." 1 ASCII codes of blocks of memory.Example subroutine:" 1 =245.04423"; 1 ;"a) The program cannot handle 1 ;"UDG Addresses" 1 ;"Turbo Compiler v1.0"; 1 ;"The AND Function" 1 ;"Special Cases" 1 ;"Simulated String Handling" 1 ;"SPACE to quit" 1 ;"Recognised Word List" 1 ;"Programming Tips" 1 ;"Press any key": 1 ;"Press ENTER to hear this example" 1 ;"PRINT #3;"; 1 ;"PRINT #2" 1 ;"PRINT #0; 1 ;"Options" 1 ;"Memory Paging" 1 ;"Line of text"; 1 ;"Key Detection" 1 ;"July-August 1990" 1 ;"Introduction" 1 ;"GOTO 90" 1 ;"February 1991" 1 ;"Expression Evaluation" 1 ;"Error Messages" 1 ;"Copy page to printer ? (Y/N)": 1 ;"Accuracy in calculations" 1 ;"9250 DATA 31,7,16,16,16,0,40,2" 1 ;"5) Error messages" 1 ;"4) Programming tips" 1 ;"3) Special cases"'' 1 ;"2) Recognised words" 1 ;"128K Memory Paging/Sound" 1 ;"1) Introduction"'' 1 ;"-------------" 1 ;" keyword": 1 ;" function": 1 ;" This will work in both Sinclairand Turbo BASIC. The next 1 ;" PRINT 24+4/3* 1 ;" PRINT 24+(((4/3)* 1 ;" LET x=x+(PEEK 23556=80)-(PEEK 1 ;" LET x=x+(INKEY$="; 1 ;" LET T=INT(RND*36)"' 1 ;" LET T=(RND*36)/100" 1 ;" AND x>0)" 1 ;" AND x<31)-( INKEY$="; 1 ;" (line number in GOTO, GOSUB or 1 ;" (duration of BEEP is variable)" 1 ;" (attempt made to use streams 1 ;" (Unrecognised keyword)" 1 ;" (Unknown function used)" 1 ;" (CLEAR lower than 24320)" 1 ;" 78*PI=234" 1 ;" (78*314)/100=245" 1 9240 IF n<>14 THEN GOTO 9210" 1 9230 LET n=n+1 1 9220 OUT 65533,n: OUT 49149,a 1 9210 READ a 1 9040 LET m=m+1: GOTO 9010" 1 9030 PRINT CHR$ c; 1 9020 IF c=255 THEN RETURN 1 9010 LET c=PEEK m 1 100 to give a far better 1 0,24;score" 1 ,"D0-D2 RAM 1 *radius^3"' 1 )*radius^3)" 1 ''"In Turbo BASIC that gives:"' 1 ''" Turbo v1.0 compiles slow 1 ''" These are the words recognised by the program:"'' 1 ''" Although many features of 1 '"c) No arrays are allowed"' 1 '"Turbo BASIC with new technique:"' 1 '"Sinclair BASIC:"' 1 '"RESTORE";: 1 '"Plus many other improvements!" 1 '"PRINT";: 1 '"Jonathan Cauldwell, 5 Helmsley 1 '"GOTO/GOSUB";: 1 '"For a copy send cheque/PO to"' 1 '"CLEAR";: 1 '"Above all, remember the old 1 '"ABS/INT";: 1 '"9200 LET n=6 1 '"9000 LET m=40000 1 '"6 Bad function"' 1 '"5 Bad keyword"' 1 '"4 PRINT #"' 1 '"3 Bad BEEP"' 1 '"2 Bad CLEAR"' 1 '"1250 IF a=4 THEN IF b>c THEN"; 1 '"1250 IF a=4 AND b>c THEN GOTO 90"' 1 '"1 No such line"' 1 '"* Simple string handling - CODE, CHR$, INKEY$, A$, B$, etc.."' 1 '"* Negative pitch values in BEEP" 1 '"* FOR ... NEXT loops" 1 '"* Extra 4K of memory to use for BASIC program or compiled code" 1 '"* Better error trapping, more 1 '" Use CHR$ and PEEK to print 1 '" Turbo BASIC version 2.1 is now available and features the 1 '" Turbo BASIC allows the user to directly page memory using OUT. In this way programs written on a 128K Spectrum will work on the+3." 1 '" To page memory, write to port 1 '" To get round this problem a 1 '" This will print out a string 1 '" This section is to teach the 1 '" This gives the address of 1 '" There are restrictions on the 1 '" The AND function can be 1 '" The 128K sound chip can be readusing IN and driven using OUT inthe same way as you would do in machine-code. The following 1 '" Strings can be accomodated by 1 '" Remember - Turbo is only a 1 '" Most games will need to detect a key when more than one is 1 '" In some situations it is not 1 '" Expressions are generally the 1 '" Because of a bug in 128K BASIC,memory paging will not work 1 '" Because Turbo works with 1 '" As previously mentioned, USR 1 '" Although INKEY$ is not 1 '" 256*PEEK 23676+PEEK 23675" 1 '" can be replaced by"' 1 '" GARBAGE IN, GARBAGE OUT" 1 "Turbo v2.1 Normally costs `4.99 but Sinclair Classic readers canhave a copy for just `3.50, witha free sprite designer program, updated tutorial and a 1 "Turbo BASIC:"' 1 "Turbo BASIC update"' 1 "R:program"; 1 " Use in the same way as you 1 " Two arguments follow. The 1 " Turbo has very poor error 1 " These have no effect in the 1 " The compiler will ignore any 1 " Returns a value from 0-99. To 1 " Must be followed by a numeric 1 " Let us say for example that we want to find the circumference 1 " Cannot print to streams other 1 " Can either be alone or followedby an argument. Argument must 1 " Can be alone (in which case it compiles as a CLS) or followed 1 " Argument must be numeric and 1 " Although not too disastrous in the majority of sums, larger 1 Jonathan Cauldwell"; 1 23556=79): LET x=x+(x<0)-(x>1)" 1 with print)" 1 removed" 1 error messages, READ/DATA bug 1 RESTORE does not exist)" 1 strings"''"b) All numbers are converted to positive integers"